package com.huai.demo_test1.singletionsecond.hungry;import java.io.Serializable;/** * 添加readResolve方法，解决序列化和反序列化获取到的实例对象不一致。具体需要阅读源码 */public class HungrySingletonSeri implements Serializable {    private final static HungrySingletonSeri hungrySingleton;    static {        hungrySingleton = new HungrySingletonSeri();    }    private HungrySingletonSeri() {    }    public static HungrySingletonSeri getInstance() {        return hungrySingleton;    }    private Object readResolve(){        return hungrySingleton;    }}